package cn.iocoder.yudao.module.aiposter.service.poster.bo;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

import java.util.Objects;

public enum PosterSizeEnum {
    /**
     * 自定义
     */
    CUSTOM(0, 0, 0),
    MOBILE(1, 540, 960),
    E_COMMERCE(2, 750, 1000),
    OFFICIAL_ACCOUNT(3, 1800,766);

    private final Integer type;
    private final Integer width;
    private final Integer height;
    PosterSizeEnum(Integer type,Integer width,Integer height ) {
        this.type = type;
        this.width = width;
        this.height = height;
    }

    @JsonValue
    public Integer getType() {
        return type;
    }

    public Integer getWidth() {
        return width;
    }

    public Integer getHeight() {
        return height;
    }

    @JsonCreator
    public static PosterSizeEnum fromValue(Integer type) {
        for (PosterSizeEnum anEnum : PosterSizeEnum.values()) {
            if (Objects.equals(anEnum.getType(), type)) {
                return anEnum;
            }
        }
        return null;
    }
}
